<div class="tarefas index">
	<h2><?php echo __('Tarefas');?> - <?php echo $nomeProjeto;?> - <?php echo $status[$idStatus]?></h2>
	<p>
		<?php echo $this->Html->link("Nova Tarefa", array('controller'=>'tarefas', 'action'=>'add', $idProjeto), array('class'=>'btn btn-primary'));?>
		<?php echo $this->Html->link("Voltar", array('controller'=>'projetos', 'action'=>'index'), array('class'=>'btn'));?>
	</p>
	
	<div class=fundo-cinza>
		<p class='text-success'>Navegue pelas opções abaixo para alternar entre os status das tarefas</p>
		<ul class="nav nav-pills">
			<li <?php if($idStatus == 1) echo 'class=active'; elseif($numeros_de_tarefas[1] == 0) echo 'class=disabled';?>>
				<?php if($numeros_de_tarefas[1] == 0) {?>
					<a><?php echo __('Não iniciada').' ('.$numeros_de_tarefas[1].')';?></a>
				<?php }else{?>
					<?php echo $this->Html->link(__('Não iniciada').' ('.$numeros_de_tarefas[1].')', array('controller'=>'tarefas', 'action'=>'index',$idProjeto, 1,'nao-feito'));?>
				<?php }?>
			</li>
			<li <?php if($idStatus == 2) echo 'class=active'; elseif($numeros_de_tarefas[2] == 0) echo 'class=disabled';?>>
				<?php if($numeros_de_tarefas[2] == 0) {?>
					<a><?php echo __('Fazendo').' ('.$numeros_de_tarefas[2].')';?></a>
				<?php }else{?>
					<?php echo $this->Html->link(__('Fazendo').' ('.$numeros_de_tarefas[2].')', array('controller'=>'tarefas', 'action'=>'index',$idProjeto, 2,'fazendo'));?>
				<?php }?>
			</li>
			<li <?php if($idStatus == 3) echo 'class=active'; elseif($numeros_de_tarefas[3] == 0) echo 'class=disabled';?>>
				<?php if($numeros_de_tarefas[3] == 0) {?>
					<a><?php echo __('Testando').' ('.$numeros_de_tarefas[3].')';?></a>
				<?php }else{?>
					<?php echo $this->Html->link(__('Testando').' ('.$numeros_de_tarefas[3].')', array('controller'=>'tarefas', 'action'=>'index',$idProjeto, 3,'testando'));?>
				<?php }?>
			</li>
			<li <?php if($idStatus == 5) echo 'class=active'; elseif($numeros_de_tarefas[5] == 0) echo 'class=disabled';?>>
				<?php if($numeros_de_tarefas[5] == 0) {?>
					<a><?php echo __('Fazendo Layout').' ('.$numeros_de_tarefas[5].')';?></a>
				<?php }else{?>
					<?php echo $this->Html->link(__('Fazendo Layout').' ('.$numeros_de_tarefas[5].')', array('controller'=>'tarefas', 'action'=>'index',$idProjeto, 5,'layout'));?>
				<?php }?>
			</li>
			<li <?php if($idStatus == 4) echo 'class=active'; elseif($numeros_de_tarefas[4] == 0) echo 'class=disabled';?>>
				<?php if($numeros_de_tarefas[4] == 0) {?>
					<a><?php echo __('Esperando resposta').' ('.$numeros_de_tarefas[4].')';?></a>
				<?php }else{?>
					<?php echo $this->Html->link(__('Esperando resposta').' ('.$numeros_de_tarefas[4].')', array('controller'=>'tarefas', 'action'=>'index',$idProjeto, 4,'esperando'));?>
				<?php }?>
			</li>
			<li <?php if($idStatus == 6) echo 'class=active'; elseif($numeros_de_tarefas[6] == 0) echo 'class=disabled';?>>
				<?php if($numeros_de_tarefas[6] == 0) {?>
					<a><?php echo __('Concluídas').' ('.$numeros_de_tarefas[6].')';?></a>
				<?php }else{?>
					<?php echo $this->Html->link(__('Concluídas').' ('.$numeros_de_tarefas[6].')', array('controller'=>'tarefas', 'action'=>'index',$idProjeto, 6,'finalizado'));?>
				<?php }?>
			</li>
		</ul>
	</div>
	<table class="table">
	<tr>
			<th width="85px"><?php echo $this->Paginator->sort('prioridade');?></th>
			<th width="190px"><?php echo $this->Paginator->sort('nome', 'Tarefa');?></th>
			<th><?php echo $this->Paginator->sort('updated', 'Última atividade');?></th>
			<th width="100px" class="actions"><?php echo __('Actions');?></th>
	</tr>
	<?php
	$i = 0;
	foreach ($tarefas as $tarefa): ?>
	<tr>
		<td><?php echo h($tarefa['Tarefa']['prioridade']); ?>&nbsp;</td>
		<td><?php echo h($tarefa['Tarefa']['nome']); ?></td>
		<td>
			<?php echo substr($tarefa['Tarefa']['descricao'], 0, 200); ?>...&nbsp;
			<p class="muted"><small>
				<?php echo h($tarefa['Tarefa']['updated_view']); ?> 
				<?php if($tarefa['UltimaMensagem']['User']['nome'] != null){?> 
				<?php echo ' por '.$tarefa['UltimaMensagem']['User']['nome']?>
			</small></p>
		</td>
		<?php }?>
		<td>
			<div class="btn-toolbar">
				<div class="btn-group">
					<?php echo $this->Html->link("<i class='icon-comment'></i>", array('action' => 'view', $tarefa['Tarefa']['id_tarefas']), array('class'=>'btn', 'escape'=>false, 'title'=>__('Mensagens'))); ?>
					<?php echo $this->Html->link("<i class='icon-edit'></i>", array('action' => 'edit', $tarefa['Tarefa']['id_tarefas']), array('class'=>'btn', 'escape'=>false, 'title'=>__('Edit'))); ?>
					<?php echo $this->Form->postLink("<i class='icon-trash'></i>", array('action' => 'delete', $tarefa['Tarefa']['id_tarefas'], $tarefas[0]['Projetos']['id_projetos']), array('class'=>'btn', 'escape'=>false, 'title'=>__('Delete')), __('Are you sure you want to delete # %s?', $tarefa['Tarefa']['id_tarefas'])); ?>
				</div>
			</div>
		</td>
	</tr>
<?php endforeach; ?>
	</table>
	<p class="text-info text-center">
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
	));
	?>	</p>

	<div class="pagination pagination-centered">
		<ul>
			<?php echo $this->Paginator->prev(
				'< '.__('Anterior'),
				array('tag' => 'li', 'class' => 'prev'),
				'<a>< '.__('Anterior').'</a>',
				array('tag' => 'li', 'escape' => false, 'class' => 'prev disabled')
			);?>
			<?php echo $this->Paginator->numbers(array('separator' => '', 'tag'=>'li', 'currentTag'=>'a', 'currentClass'=>'active')); ?>
			<?php echo $this->Paginator->next(
				__('Próximo'). ' >',
				array('tag' => 'li', 'class' => 'prev'),
				'<a>'.__('Próximo').' ></a>',
				array('tag' => 'li', 'escape' => false, 'class' => 'prev disabled')
			);?>
		</ul>
	</div>
</div>